import requests
from requests.auth import HTTPBasicAuth

# url = 'http://127.0.0.1:8000/admin'
# response = requests.get(url)
# print(response.text)




# url = 'http://127.0.0.1:8000/admin'
# response = requests.get(url,allow_redirects=False)
# print(response)
# print(response.status_code)
# print(response.headers.get('location'))
# # print(response.text)
# location = response.headers.get('location')
# location = f"http://127.0.0.1:8000{location}"
# response = requests.get(location)
# print(response.status_code)
# print(response.text)




import requests
from requests.auth import HTTPBasicAuth
url = 'http://127.0.0.1:8000/admin/'
headers = {
    # 'cookie':"csrftoken=74YF0ZbXev3gUmQTjL2uoDcgeHGeMYOp; sessionid=3hsbo42vy0d13v8ixs044r0myduyfnvb"
}
cookies ={
    # "sessionid":"3hsbo42vy0d13v8ixs044r0myduyfnvb",
}
auth ={
    'username':"admin",
    'password':"123456"
}
response = requests.get(url,headers=headers,cookies=cookies,auth = HTTPBasicAuth('admin','123456'))
print(response.status_code)
print(response.text)